#ifndef __http_h_ 
#define __http_h_ 1

#include "sys.h"
#include "net.h"

enum{
    HTTP_DIAL_SUCCESS = 0,
    HTTP_DIAL_ERR,
    HTTP_DIAL_ERR_URI,
    HTTP_DIAL_ERR_TYPE,
    HTTP_DIAL_ERR_FAILED,
    HTTP_DIAL_ERR_SELECT,
};

typedef struct{
    char* uri;
    char **uris;
    int uris_count;
    int *rt_bytes_ptr;
    float *valid_bytes_ptr;
    int threads;
    uint32_t ipaddr;
    uint16_t port;
    int timeout;
    int duration, interval;
    int ignore_duration;
    void (*callback)( void *);
}http_arg_t;

typedef struct{
    char label[32];
    int code;
    double latency;
    int total_bytes, valid_bytes;
    float total_time, valid_time;
    double rate;
    double max_rate;
    double min_rate;
}http_result_t;

extern void* do_http_download(void *);
extern void* do_http_upload(void *);
extern void* do_http(void *);
extern void http_result_print(http_result_t *result);
extern int http_get_host( char *uri, char *host);



#endif